package com.naml.j_printstream;

import java.io.FileNotFoundException;
import java.io.PrintWriter;

/**
 * @author marin
 * @version 1.0
 * @date 2025/4/25 20:15
 * @desc 字符打印流
 */
@SuppressWarnings("all")
public class PrintWriter02 {
    public static void main(String[] args) {
        PrintWriter printWriter = new PrintWriter(System.out, true);
        printWriter.println("Hello World");
        //改到打印到文件中
        try {
            PrintWriter printWriter1 = new PrintWriter("/Users/marin/new2.txt");
            printWriter1.println("哈哈哈哈哈哈");
            printWriter1.close();
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }

    }
}
